package net.crowdloud.server.DatabaseAccess.user;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import net.crowdloud.server.DatabaseAccess.problem.Problem;
import net.crowdloud.server.DatabaseAccess.solution.Solution;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.Text;

@PersistenceCapable
public class User implements Serializable {

	private static final long serialVersionUID = 1L;

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key userID;

	@Persistent
	private String nickName;

	@Persistent
	private String name;

	@Persistent
	private String contact;

	@Persistent
	private String email;

	@Persistent
	private String password;

	@Persistent
	private Text groups;

	@Persistent(defaultFetchGroup = "true")
	private List<Problem> userProblems = new ArrayList<Problem>();

	@Persistent(defaultFetchGroup = "true")
	private List<Solution> userSolutions = new ArrayList<Solution>();

	public Key getUserID() {
		return userID;
	}

	public String getContact() {
		return contact;
	}

	public void setContact(String contact) {
		this.contact = contact;
	}

	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public Text getGroups() {
		return groups;
	}

	public void setGroups(Text groups) {
		this.groups = groups;
	}

	public List<Problem> getUserProblems() {
		return userProblems;
	}

	public void setUserProblems(List<Problem> userProblems) {
		this.userProblems = userProblems;
	}

	public List<Solution> getUserSolutions() {
		return userSolutions;
	}

	public void setUserSolutions(List<Solution> userSolutions) {
		this.userSolutions = userSolutions;
	}

}
